<!--#include file="../Lib/base.asp"-->
<%
	dim datadb,datadb2,openid,result
	dim i
	dim act:act=lcase(Cls.fget("act",0))	
	select case act
		case "send":send
	end select
	
	sub send()
		dim Content
		openid=Cls.enhtml(Cls.fget("openid",0))
		Content=Cls.enhtml(Cls.fpost("Content",0))
		datadb=Cls.db.dbload("","WeiXinOpenID","[sys_Config]","id=1","")
		result=PostMsg(datadb(0,0),openid,Content)
		Cls.echo result
		Cls.die
	end sub
	
%>
<!--#include file="../lib/Sys_Top.asp"-->
<script>
function checkedit(the,openid)
{
	if($.trim(the.Content.value)=="")
		{
			$.message({content:"回复内容不能为空"});
			the.Content.focus();
			return false;
	}
	var url,data;
	url="?act=send&openid="+openid+"";
	data="Content="+encodeURIComponent($.trim(the.Content.value));
	
	$.ajax({
	type:"post",
	cache:false,
	url:url,
	data:data,
	error:function(){$.message({type:"error",content:"服务器错误，操作失败！"});},
	success:function(_)
	{
		var act=_.substring(0,1);
		var info=_.substring(1);
		switch(act)
		{
			case "0":
				$.message({type:"error",content:info});
				break;
			case "1":
				$.message({type:"ok",content:"发送成功"});				
				setTimeout("closeDialog()",1500);
				break;
			default:
				alert(_)
				break;
		}
	}
	});
	return false
}
function closeDialog(){
	var list = parent.art.dialog.list;
	for (var i in list) {
		list[i].close();
	};
}

</script>
</head>
<body style="margin:0; padding:0">
<%openid=Cls.enhtml(Cls.fget("openid",0))%>
<div class="clear_fixed">
  <form onSubmit="return checkedit(this,'<%=openid%>')">
    <dl class="addlist">
      <dt style="text-align:center; height:120px; vertical-align:middle;">
        <textarea name="Content" cols="60" rows="7"></textarea>
      </dt>
      <dd style="text-align:center">
        <input type="submit" name="send" value="回复" />
        <input type="button" value="返回" onClick="closeDialog()" />
      </dd>
    </dl>
  </form>
</div>
</body>
</html>
